package com.houdoudou.bean;

import javax.servlet.http.HttpServletRequest;

public class Distribute {

	int machine=0; //字体贵编号
	String supplier=""; //商家电话
	int timeFlag=0; // 时间标签 ，1表示早上，2表示中午，3，表示晚上
	String owner="";//业主电话
	String timeAA="0000";//约定送达时间。
	public Distribute() {
		
	}
	
	public int getMachine() {
		return machine;
	}

	public void setMachine(int machine) {
		this.machine = machine;
	}

	public String getSupplier() {
		return supplier;
	}
	public void setSupplier(String supplier) {
		this.supplier = supplier;
	}
	
	
	public int getTimeFlag() {
		return timeFlag;
	}

	public void setTimeFlag(int timeFlag) {
		this.timeFlag = timeFlag;
	}

	public String getTimeAA() {
		return timeAA;
	}

	public void setTimeAA(String timeAA) {
		this.timeAA = timeAA;
	}

	public String getOwner() {
		return owner;
	}

	public void setOwner(String owner) {
		this.owner = owner;
	}

	
	
public static Distribute beanFromRequest(HttpServletRequest req) throws Exception {
		
		Distribute distribute= new Distribute();
		if(req.getParameter("machine")!=null){	
			if(!req.getParameter("machine").isEmpty()){
			int machine=Integer.parseInt(req.getParameter("machine"));
				distribute.setMachine(machine);
	           }}
		if(req.getParameter("supplier")!=null){	
				distribute.setSupplier(req.getParameter("supplier"));
	           }
		if(req.getParameter("timeFlag")!=null){	
			if(!req.getParameter("timeFlag").isEmpty()){
				int time=Integer.parseInt(req.getParameter("timeFlag"));
				distribute.setTimeFlag(time);
	           }}
		if(req.getParameter("owner")!=null){	
			if(!req.getParameter("owner").isEmpty()){
				distribute.setOwner(req.getParameter("owner"));
	           }}
		if(req.getParameter("timeAA")!=null){	
			if(!req.getParameter("timeAA").isEmpty()){
				distribute.setTimeAA(req.getParameter("timeAA"));
	           }}
		print("bean from request",distribute);
		return distribute;
	}
public static void print(String when, Distribute distribute){
	System.out.println(when);
	System.out.println("DistributeBean"
	+"  machine="+distribute.getMachine()+
	"   supplier="+distribute.getSupplier()+
	"   timeFlag="+distribute.getTimeFlag()+
	"   timeAA="+distribute.getTimeAA());
}

}
